package com.baselibrary.test.ui;

import android.os.Bundle;
import android.os.Handler;
import android.widget.EditText;

import com.baselibrary.libs.View.TestView.MyView1;
import com.baselibrary.libs.View.TestView.MyView2;
import com.baselibrary.libs.View.TestView.ProgressView;
import com.baselibrary.libs.View.bar.initAction_Bar;
import com.baselibrary.libs.base.baseActivity.BaseActivity;
import com.baselibrary.test.R;

/**8
 * 画画时间到了activity
 */
public class Main8Activity extends BaseActivity {

    private EditText edit;
    private initAction_Bar action_bar;
    private MyView1 mMyView;
    private MyView1 mMyView1;
    private MyView2 mMyView2;
    private ProgressView mPv;
    int poess = 0;

    private Handler mHandler = new Handler(){
    };
    private Runnable mRunnable = new Runnable() {
        @Override
        public void run() {
            if (poess<100){
                poess++;
                mPv.setProgress(poess);
                mHandler.postDelayed(mRunnable,50);
            }else{
                mHandler.removeCallbacks(mRunnable);
            }


        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getlayouXML() {
        return R.layout.activity_main8;
    }

    @Override
    public void initP() {

    }

    @Override
    public void initView() {

       // mMyView1 = (MyView1)findViewById(R.id.myView1);
      //  mMyView2 = (MyView2)findViewById(R.id.myView2);
        action_bar = (initAction_Bar) findViewById(R.id.action_bar);
        action_bar.set_Title("画图时间到了");


        mPv = (ProgressView)findViewById(R.id.pv);

        initData();
    }

    @Override
    public void initData() {
        mPv.setCallBack(new ProgressView.ProgressCallBack() {
            @Override
            public void onProgress(int progress) {
                poess = progress;
            }

            @Override
            public void onStart() {
                mHandler.removeCallbacks(mRunnable);
            }

            @Override
            public void onStop() {
                mHandler.removeCallbacks(mRunnable);
                mHandler.postDelayed(mRunnable,50);
            }
        });

        mHandler.postDelayed(mRunnable,50);

    }

    @Override
    public void initListener() {

    }

}
